{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import plopp as pp\n",
    "import scipp as sc\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "nclusters = 100\n",
    "npercluster = 1000\n",
    "\n",
    "position = np.zeros((nclusters, npercluster, 3))\n",
    "values = np.zeros((nclusters, npercluster))\n",
    "\n",
    "for n in range(nclusters):\n",
    "    center = 500.0 * (np.random.random(3) - 0.5)\n",
    "    r = 20.0 * np.random.normal(size=[npercluster, 3])\n",
    "    position[n, :] = r + center\n",
    "    values[n, :] = np.linalg.norm(r, axis=1) + n\n",
    "\n",
    "da = sc.DataArray(\n",
    "    data=sc.array(dims=['row'], values=values.flatten(), unit='K'),\n",
    "    coords={\n",
    "        'position': sc.vectors(\n",
    "            dims=['row'], unit='m', values=position.reshape(nclusters * npercluster, 3)\n",
    "        )\n",
    "    },\n",
    ")\n",
    "da"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pp.scatter3d(da, pos='position', figsize=(550, 400))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "time = np.linspace(0, 10, 50)\n",
    "x = np.cos(time)\n",
    "y = np.sin(time)\n",
    "\n",
    "da = sc.DataArray(\n",
    "    data=sc.array(dims=['row'], values=time),\n",
    "    coords={\n",
    "        'x': sc.array(dims=['row'], unit='m', values=x),\n",
    "        'y': sc.array(dims=['row'], unit='m', values=y),\n",
    "        'time': sc.array(dims=['row'], unit='s', values=time),\n",
    "    },\n",
    ")\n",
    "pp.scatter3d(da, x='x', y='y', z='time', figsize=(550, 400), pixel_size=0.2)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
